using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace SSDS
{
    /// <summary>
    /// Summary description for Prompt.
    /// </summary>
    public class Prompt : System.Windows.Forms.Form
    {
        public System.Windows.Forms.TextBox Entry;
        public System.Windows.Forms.Label Label;
        private System.Windows.Forms.Button m_OKButton;
        private System.Windows.Forms.Button m_CancelButton;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Prompt()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.m_OKButton = new System.Windows.Forms.Button();
            this.m_CancelButton = new System.Windows.Forms.Button();
            this.Label = new System.Windows.Forms.Label();
            this.Entry = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            // 
            // m_OKButton
            // 
            this.m_OKButton.Location = new System.Drawing.Point(288, 8);
            this.m_OKButton.Name = "m_OKButton";
            this.m_OKButton.TabIndex = 1;
            this.m_OKButton.Text = "OK";
            this.m_OKButton.Click += new System.EventHandler(this.OnOK);
            // 
            // m_CancelButton
            // 
            this.m_CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.m_CancelButton.Location = new System.Drawing.Point(288, 40);
            this.m_CancelButton.Name = "m_CancelButton";
            this.m_CancelButton.TabIndex = 2;
            this.m_CancelButton.Text = "Cancel";
            // 
            // Label
            // 
            this.Label.Location = new System.Drawing.Point(8, 16);
            this.Label.Name = "Label";
            this.Label.Size = new System.Drawing.Size(272, 72);
            this.Label.TabIndex = 2;
            this.Label.Text = "File Selection:";
            // 
            // Entry
            // 
            this.Entry.Location = new System.Drawing.Point(8, 96);
            this.Entry.Name = "Entry";
            this.Entry.Size = new System.Drawing.Size(352, 20);
            this.Entry.TabIndex = 0;
            this.Entry.Text = "";
            // 
            // Prompt
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.CancelButton = this.m_CancelButton;
            this.ClientSize = new System.Drawing.Size(370, 124);
            this.ControlBox = false;
            this.Controls.Add(this.Entry);
            this.Controls.Add(this.Label);
            this.Controls.Add(this.m_CancelButton);
            this.Controls.Add(this.m_OKButton);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Prompt";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Prompt";
            this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.OnKeyPress);
            this.Load += new System.EventHandler(this.OnLoad);
            this.ResumeLayout(false);

        }
        #endregion

        private void OnLoad(object sender, System.EventArgs e)
        {
            Entry.Focus();
        }

        private void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                m_OKButton.PerformClick();
                e.Handled = true;
            }
        }

        private void OnOK(object sender, System.EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }

    }
}
